home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk61 / loadiff / picload < prev    next >
Text File  |  1995-03-19  |  2KB  |  70 lines

  1. '* This is just a short demo of the iff.lib being accessed
  2. '* from AmigaBasic. I only was interested in loading a picture
  3. '* that I knew was the size and depth of the window I was using.
  4. '* To show any picture check format with GetBHTD, then open the
  5. '* screen and window.
  6. '* J.R.Boyd  1/16/89
  7.  
  8. SCREEN 1,640,200,3,2
  9. WINDOW 2,"MyWindow",,22,1
  10.  
  11. DECLARE FUNCTION OpenIFF& LIBRARY
  12. DECLARE FUNCTION GetBMHD& LIBRARY
  13. DECLARE FUNCTION GetColorTab& LIBRARY
  14. DECLARE FUNCTION DecodePic& LIBRARY
  15. DECLARE FUNCTION IffError& LIBRARY
  16.  
  17. LIBRARY "iff.library"
  18. LIBRARY "graphics.library"
  19.  
  20. CLS
  21. LOCATE 10,10
  22. PRINT "Input the name of a 640x200 picture"
  23. LOCATE 12,10
  24. INPUT "FileName: ";filename$
  25. filename$=filename$+CHR$(0)
  26. iff& = OpenIFF&(SADD(filename$))
  27. IF iff&=0 THEN
  28.   LOCATE 14,10
  29.   Er& = IffError&
  30.   IF Er& = 16 THEN
  31.      PRINT "File not found!!"
  32.   ELSEIF Er& = 18 THEN
  33.      PRINT "Not enough free RAM!!"
  34.   ELSE 
  35.      PRINT "Iff Error #";Er&
  36.   END IF
  37.   GOTO BadQuit
  38. END IF
  39.  
  40. 'If you don't know the width,height,depth,mode
  41. 'bmhd& = GetBMHD&(iff&)
  42. 'IF bmhd& = 0 THEN
  43. '   PRINT "cant find bit map header"
  44. '   STOP
  45. '   END IF
  46.  
  47. sWindow& = WINDOW(7)
  48. sScreen& = PEEKL(sWindow& + 46&)
  49. sViewPort& = sScreen& + 44&
  50. sRastPort& = sScreen& + 84&
  51. sColorMap& = PEEKL(sViewPort& + 4&)
  52. ColorTab& = PEEKL(sColorMap& +4&)
  53. sBitMap&=PEEKL(sRastPort& + 4&)
  54.  
  55. Colr& = GetColorTab&(iff&,ColorTab&)
  56. CALL LoadRGB4&(sViewPort&,ColorTab&,Colr&)
  57. Bmp& = DecodePic&(iff&,sBitMap&)
  58. CALL CloseIFF&(iff&) 
  59.  
  60. BadQuit:
  61. 'Show the picture for awhile
  62. FOR I=1 TO 10000:NEXT I
  63.  
  64. WINDOW CLOSE 2
  65. SCREEN CLOSE 1
  66. LIBRARY CLOSE
  67.  
  68.  
  69.  
  70.